DROP TABLE IF EXISTS `common_file`;
CREATE TABLE `common_file` (
  `id` bigint(20) unsigned NOT NULL COMMENT 'ID',
  `file_name` varchar(100) NOT NULL COMMENT '名称',
  `url` varchar(200) DEFAULT NULL COMMENT 'URL',
  `file_size` bigint(10) NOT NULL COMMENT '大小（B）',
  `suffix` varchar(10) NOT NULL COMMENT '后缀',
  `content_type` varchar(255) NOT NULL COMMENT '内容类型',
  `module` varchar(20) NOT NULL COMMENT '模块',
  `state` tinyint(4) unsigned NOT NULL COMMENT '状态(1未使用  2已使用  3已删除)',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `update_time` datetime NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件表';

DROP TABLE IF EXISTS `sys_log`;
CREATE TABLE `sys_log` (
  `id` bigint(20) unsigned NOT NULL COMMENT 'ID',
  `user_id` bigint(20) unsigned DEFAULT NULL COMMENT '用户ID',
  `module` varchar(20) NOT NULL COMMENT '模块',
  `url` varchar(50) NOT NULL COMMENT '接口地址',
  `param` varchar(2000) DEFAULT NULL COMMENT '请求参数',
  `time` int(11) unsigned NOT NULL COMMENT '耗时',
  `ip` varchar(20) NOT NULL COMMENT 'IP',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `update_time` datetime NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统日志';

DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` (
  `id` bigint(20) unsigned NOT NULL COMMENT 'ID',
  `menu_name` varchar(20) NOT NULL COMMENT '名称',
  `url` varchar(100) DEFAULT NULL COMMENT 'URL',
  `parent_id` bigint(20) unsigned NOT NULL COMMENT '父ID',
  `type` tinyint(4) unsigned NOT NULL COMMENT '类型(1菜单 2按钮)',
  `sort` tinyint(4) unsigned NOT NULL COMMENT '排序',
  `perms` varchar(50) DEFAULT NULL COMMENT '权限标识',
  `icon` varchar(50) DEFAULT NULL COMMENT '图标',
  `remark` varchar(100) DEFAULT NULL COMMENT '备注',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `update_time` datetime NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单表';

BEGIN;
INSERT INTO `sys_menu` VALUES (790685621315174391, '系统管理', NULL, 0, 1, 1, NULL, NULL, NULL, '2020-12-14 09:58:16', '2020-12-14 09:58:19');
INSERT INTO `sys_menu` VALUES (790685621315174392, '用户管理', 'sys/user/index', 790685621315174391, 1, 1, NULL, NULL, NULL, '2020-12-14 09:58:31', '2020-12-14 09:58:33');
INSERT INTO `sys_menu` VALUES (790685621315174393, '角色管理', 'sys/role/index', 790685621315174391, 1, 2, NULL, NULL, NULL, '2020-12-14 09:58:48', '2020-12-14 09:58:50');
INSERT INTO `sys_menu` VALUES (790685621315174394, '菜单管理', 'sys/menu/index', 790685621315174391, 1, 3, NULL, NULL, NULL, '2020-12-14 09:59:11', '2020-12-14 09:59:13');
INSERT INTO `sys_menu` VALUES (790685621315174395, '工具管理', NULL, 0, 1, 2, NULL, NULL, NULL, '2020-12-14 09:59:40', '2020-12-14 09:59:43');
INSERT INTO `sys_menu` VALUES (790685621315174396, '接口文档', 'tool/api/index', 790685621315174395, 1, 1, NULL, NULL, NULL, '2020-12-14 09:59:58', '2020-12-14 10:00:00');
INSERT INTO `sys_menu` VALUES (790685621315174397, '新增', 'sys/user/save', 790685621315174392, 2, 1, NULL, NULL, NULL, '2020-12-14 16:27:21', '2020-12-14 16:27:24');
INSERT INTO `sys_menu` VALUES (790685621315174398, '修改', 'sys/user/update', 790685621315174392, 2, 2, NULL, NULL, NULL, '2020-12-14 16:28:08', '2020-12-14 16:28:11');
INSERT INTO `sys_menu` VALUES (790685621315174399, '删除', 'sys/user/delete', 790685621315174392, 2, 3, NULL, NULL, NULL, '2020-12-14 16:27:44', '2020-12-14 16:27:46');
INSERT INTO `sys_menu` VALUES (791030016061210624, '新增', 'sys/role/save', 790685621315174393, 2, 1, '', '', '', '2020-12-22 19:50:52', '2020-12-22 19:50:52');
INSERT INTO `sys_menu` VALUES (791030103139155968, '修改', 'sys/role/update', 790685621315174393, 2, 2, '', '', '', '2020-12-22 19:51:13', '2020-12-22 19:51:13');
INSERT INTO `sys_menu` VALUES (791030159988752384, '删除', 'sys/role/delete', 790685621315174393, 2, 3, '', '', '', '2020-12-22 19:51:27', '2020-12-22 19:51:27');
INSERT INTO `sys_menu` VALUES (791030401022820352, '新增', 'sys/menu/save', 790685621315174394, 2, 1, '', '', '', '2020-12-22 19:52:24', '2020-12-22 19:52:24');
INSERT INTO `sys_menu` VALUES (791030460300918784, '修改', 'sys/menu/update', 790685621315174394, 2, 2, '', '', '', '2020-12-22 19:52:38', '2020-12-22 19:52:38');
INSERT INTO `sys_menu` VALUES (791030508703186944, '删除', 'sys/menu/delete', 790685621315174394, 2, 3, '', '', '', '2020-12-22 19:52:50', '2020-12-22 19:52:50');
INSERT INTO `sys_menu` VALUES (791030850840952832, '导出', 'tool/api/export', 790685621315174396, 2, 1, '', '', '', '2020-12-22 19:54:11', '2020-12-22 19:54:11');
INSERT INTO `sys_menu` VALUES (791059333109514240, '数据库表', 'tool/table/index', 790685621315174395, 1, 2, '', '', '', '2020-12-22 21:47:22', '2020-12-22 21:47:22');
INSERT INTO `sys_menu` VALUES (791059499094900736, '导出', 'tool/table/export', 791059333109514240, 2, 1, '', '', '', '2020-12-22 21:48:02', '2020-12-22 21:48:02');
INSERT INTO `sys_menu` VALUES (818612314600112128, '系统日志', 'sys/log/index', 790685621315174391, 1, 4, '', '', '', '2021-03-08 22:33:05', '2021-03-08 22:33:05');
COMMIT;

DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
  `id` bigint(20) unsigned NOT NULL COMMENT 'ID',
  `role_name` varchar(20) NOT NULL COMMENT '名称',
  `remark` varchar(100) DEFAULT NULL COMMENT '备注',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `update_time` datetime NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表';

BEGIN;
INSERT INTO `sys_role` VALUES (788443668091502592, '用户管理员', '添加用户', '2020-12-15 16:33:39', '2020-12-15 16:33:39');
INSERT INTO `sys_role` VALUES (788446483442565120, '日志管理员', '查看系统日志', '2020-12-15 16:44:50', '2020-12-15 16:44:50');
INSERT INTO `sys_role` VALUES (788456340673527808, '接口管理', '查看导出接口', '2020-12-15 17:24:00', '2020-12-15 17:24:00');
INSERT INTO `sys_role` VALUES (793478022370951168, '管理员', '所有权限', '2020-12-29 13:58:23', '2020-12-29 13:58:23');
COMMIT;

DROP TABLE IF EXISTS `sys_role_menu`;
CREATE TABLE `sys_role_menu` (
  `id` bigint(20) unsigned NOT NULL COMMENT 'ID',
  `role_id` bigint(20) unsigned NOT NULL COMMENT '角色ID',
  `menu_id` bigint(20) unsigned NOT NULL COMMENT '菜单ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色关联菜单表';

BEGIN;
INSERT INTO `sys_role_menu` VALUES (818964508629270528, 788443668091502592, 790685621315174392);
INSERT INTO `sys_role_menu` VALUES (818964508650242048, 788443668091502592, 790685621315174397);
INSERT INTO `sys_role_menu` VALUES (818964508667019264, 788443668091502592, 790685621315174398);
INSERT INTO `sys_role_menu` VALUES (818964508708962304, 788443668091502592, 790685621315174399);
INSERT INTO `sys_role_menu` VALUES (818964508738322432, 788443668091502592, 790685621315174393);
INSERT INTO `sys_role_menu` VALUES (818964508767682560, 788443668091502592, 791030016061210624);
INSERT INTO `sys_role_menu` VALUES (818964508788654080, 788443668091502592, 791030103139155968);
INSERT INTO `sys_role_menu` VALUES (818964508801236992, 788443668091502592, 791030159988752384);
INSERT INTO `sys_role_menu` VALUES (818964508809625600, 788443668091502592, 790685621315174394);
INSERT INTO `sys_role_menu` VALUES (818964508843180032, 788443668091502592, 791030401022820352);
INSERT INTO `sys_role_menu` VALUES (818964508864151552, 788443668091502592, 791030460300918784);
INSERT INTO `sys_role_menu` VALUES (818964508872540160, 788443668091502592, 791030508703186944);
INSERT INTO `sys_role_menu` VALUES (818964508880928768, 788443668091502592, 790685621315174391);
INSERT INTO `sys_role_menu` VALUES (818964894643650560, 788446483442565120, 818612314600112128);
INSERT INTO `sys_role_menu` VALUES (818964894660427776, 788446483442565120, 790685621315174391);
INSERT INTO `sys_role_menu` VALUES (818965174714105856, 788456340673527808, 790685621315174396);
INSERT INTO `sys_role_menu` VALUES (818965174726688768, 788456340673527808, 791030850840952832);
INSERT INTO `sys_role_menu` VALUES (818965174735077376, 788456340673527808, 790685621315174395);
INSERT INTO `sys_role_menu` VALUES (818965450313433088, 793478022370951168, 790685621315174391);
INSERT INTO `sys_role_menu` VALUES (818965450326016000, 793478022370951168, 790685621315174392);
INSERT INTO `sys_role_menu` VALUES (818965450342793216, 793478022370951168, 790685621315174397);
INSERT INTO `sys_role_menu` VALUES (818965450355376128, 793478022370951168, 790685621315174398);
INSERT INTO `sys_role_menu` VALUES (818965450397319168, 793478022370951168, 790685621315174399);
INSERT INTO `sys_role_menu` VALUES (818965450435067904, 793478022370951168, 790685621315174393);
INSERT INTO `sys_role_menu` VALUES (818965450443456512, 793478022370951168, 791030016061210624);
INSERT INTO `sys_role_menu` VALUES (818965450451845120, 793478022370951168, 791030103139155968);
INSERT INTO `sys_role_menu` VALUES (818965450468622336, 793478022370951168, 791030159988752384);
INSERT INTO `sys_role_menu` VALUES (818965450472816640, 793478022370951168, 790685621315174394);
INSERT INTO `sys_role_menu` VALUES (818965450481205248, 793478022370951168, 791030401022820352);
INSERT INTO `sys_role_menu` VALUES (818965450497982464, 793478022370951168, 791030460300918784);
INSERT INTO `sys_role_menu` VALUES (818965450510565376, 793478022370951168, 791030508703186944);
INSERT INTO `sys_role_menu` VALUES (818965450523148288, 793478022370951168, 818612314600112128);
INSERT INTO `sys_role_menu` VALUES (818965450535731200, 793478022370951168, 790685621315174395);
INSERT INTO `sys_role_menu` VALUES (818965450544119808, 793478022370951168, 790685621315174396);
INSERT INTO `sys_role_menu` VALUES (818965450552508416, 793478022370951168, 791030850840952832);
INSERT INTO `sys_role_menu` VALUES (818965450569285632, 793478022370951168, 791059333109514240);
INSERT INTO `sys_role_menu` VALUES (818965450577674240, 793478022370951168, 791059499094900736);
COMMIT;

DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
  `id` bigint(20) unsigned NOT NULL COMMENT 'ID',
  `login_name` varchar(20) NOT NULL COMMENT '登录名',
  `pwd` varchar(64) NOT NULL COMMENT '密码',
  `user_name` varchar(20) NOT NULL COMMENT '姓名',
  `sex` tinyint(4) unsigned NOT NULL COMMENT '性别(1男  2女)',
  `birth_date` date NOT NULL COMMENT '出生日期',
  `phone` varchar(20) NOT NULL COMMENT '手机号码',
  `type` tinyint(4) unsigned NOT NULL COMMENT '用户类型(0内置用户 1注册用户)',
  `avatar` varchar(100) DEFAULT NULL COMMENT '头像',
  `state` tinyint(4) unsigned NOT NULL COMMENT '状态(1正常  2删除)',
  `province` varchar(10) DEFAULT NULL COMMENT '省',
  `city` varchar(10) DEFAULT NULL COMMENT '市',
  `area` varchar(10) DEFAULT NULL COMMENT '区',
  `address` varchar(50) DEFAULT NULL COMMENT '地址',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `update_time` datetime NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';

BEGIN;
INSERT INTO `sys_user` VALUES (788051193841582012, 'admin', '$2a$10$VVBZhDn6VP3ua2TYV1uAsO5T5t1xnD6AdQKzjSNGc.NebdgVcS3ge', '管理员', 1, '2020-12-14', '13000000000', 0, '', 1, '', '', '', '', '2020-12-14 09:57:51', '2020-12-14 09:57:54');
INSERT INTO `sys_user` VALUES (791056367472345088, 'jsbb1', '$2a$10$msPqnMeCb4ghJaKh195.U.xxpHb8obH.hKYxHMHUdlf6JA6DSeT6W', 'jsbb1', 1, '2020-12-10', '13000000001', 1, NULL, 1, '', '', '', '', '2020-12-22 21:35:35', '2020-12-22 21:35:35');
INSERT INTO `sys_user` VALUES (791056411923578880, 'jsbb2', '$2a$10$3gkO1CVZYFws/MivO9oO4O1Hdehakc/RKfc415RmWDkY0noGV2g72', 'jsbb2', 2, '2021-02-01', '13000000002', 1, NULL, 1, '', '', '', '', '2020-12-22 21:35:46', '2020-12-22 21:35:46');
COMMIT;

DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role` (
  `id` bigint(20) unsigned NOT NULL COMMENT 'ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `role_id` bigint(20) unsigned NOT NULL COMMENT '角色ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户关联角色表';

BEGIN;
INSERT INTO `sys_user_role` VALUES (818967795793395712, 791056367472345088, 788443668091502592);
INSERT INTO `sys_user_role` VALUES (818968364444549120, 791056411923578880, 793478022370951168);
COMMIT;

